import request from '@/utils/request'

// 终端属性/地域/新增用户
export function getSelectAreaNewUserByDate(data) {
  let url = '';
	let baseUrl = `${process.env.VUE_APP_BASE_API}/gmDevice/selectAreaNewUserByDate?appKey=${data.appKey}&startDate=${data.startDate}&endDate=${data.endDate}`;
	url = baseUrl + (data.channel ? ('&channel=' + data.channel) : ('')) + (data.version ? ('&appVersion=' + data.version) : (''))
  return request({
    url,
    method: 'get',
    headers: {
      'Content-Type': 'x-www-form-urlencoded'
    }
  })
}

// 终端属性/地域/活跃用户
export function getSelectAreaActiveUserByDate(data) {
  let url = '';
	let baseUrl = `${process.env.VUE_APP_BASE_API}/gmDevice/selectAreaActiveUserByDate?appKey=${data.appKey}&startDate=${data.startDate}&endDate=${data.endDate}`;
	url = baseUrl + (data.channel ? ('&channel=' + data.channel) : ('')) + (data.version ? ('&appVersion=' + data.version) : (''))
  return request({
    url,
    method: 'get',
    headers: {
      'Content-Type': 'x-www-form-urlencoded'
    }
  })
}

// 终端属性/地域/启动次数
export function getSelectAreaOpenCountByDate(data) {
  let url = '';
	let baseUrl = `${process.env.VUE_APP_BASE_API}/gmDevice/selectAreaOpenCountByDate?appKey=${data.appKey}&startDate=${data.startDate}&endDate=${data.endDate}`;
	url = baseUrl + (data.channel ? ('&channel=' + data.channel) : ('')) + (data.version ? ('&appVersion=' + data.version) : (''))
  return request({
    url,
    method: 'get',
    headers: {
      'Content-Type': 'x-www-form-urlencoded'
    }
  })
}

// 终端属性/地域-市
export function getSelectCountByCity(data) {
  let url = '';
	let baseUrl = `${process.env.VUE_APP_BASE_API}/gmDevice/selectCountByCity?appKey=${data.appKey}&startDate=${data.startDate}&endDate=${data.endDate}&province=${data.province}`;
	url = baseUrl + (data.channel ? ('&channel=' + data.channel) : ('')) + (data.version ? ('&appVersion=' + data.version) : (''))
  return request({
    url,
    method: 'get',
    headers: {
      'Content-Type': 'x-www-form-urlencoded'
    }
  })
}